package flc.ast.adapter;

import android.graphics.Color;
import android.view.View;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkEmptyProvider;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.bean.StkResBean;

public class HotAdapter extends StkProviderMultiAdapter<StkResBean> {

    public HotAdapter() {
        addItemProvider(new StkEmptyProvider<>(112));
        addItemProvider(new HotProvider());
    }

    private class HotProvider extends BaseItemProvider<StkResBean> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_hot;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, StkResBean bean) {
            baseViewHolder.setText(R.id.tvHotItemTitle, bean.getName());
            int position=baseViewHolder.getBindingAdapterPosition();
            if (position==0){
                baseViewHolder.setImageResource(R.id.ivHotItemLog,R.drawable.ahuat1);
                baseViewHolder.setTextColor(R.id.tvHotItemTitle, Color.parseColor("#FF4949"));
                baseViewHolder.getView(R.id.ivHotItemLog).setVisibility(View.VISIBLE);
                baseViewHolder.getView(R.id.tvHotItemLog).setVisibility(View.GONE);
            }else if (position==1){
                baseViewHolder.setImageResource(R.id.ivHotItemLog,R.drawable.ahuatier);
                baseViewHolder.getView(R.id.ivHotItemLog).setVisibility(View.VISIBLE);
                baseViewHolder.getView(R.id.tvHotItemLog).setVisibility(View.GONE);
            }else if (position==2){
                baseViewHolder.setImageResource(R.id.ivHotItemLog,R.drawable.ahuatisan);
                baseViewHolder.getView(R.id.ivHotItemLog).setVisibility(View.VISIBLE);
                baseViewHolder.getView(R.id.tvHotItemLog).setVisibility(View.GONE);
            }else {
                baseViewHolder.setText(R.id.tvHotItemLog,position+1+"");
                baseViewHolder.getView(R.id.tvHotItemLog).setVisibility(View.VISIBLE);
                baseViewHolder.getView(R.id.ivHotItemLog).setVisibility(View.GONE);
            }
        }
    }

}
